<div class="col-md-4">
    <!-- 多语切换 -->
    {if $langs}
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">{$localize.language}</h3>
        </div>
        <div class="panel-body">
            <!-- Panel content -->
            <div class="form-inline" style="margin-bottom:15px;">
                <div class="form-group select-language">
                    <a data-slug="en" href="javascript:;">English</a> | 
                    <a data-slug="zh-CN" href="javascript:;" class="ignore">简体中文</a> | 
                    <a data-slug="zh-TW" href="javascript:;">繁體中文</a>
                </div>
            </div>
            <div class="form-horizontal" style="padding:0 15px;">
                <div class="form-group">
                    <label for="selectLanguage">{$localize.choose_language}:</label>
                    <select id="selectLanguage" class="selectLanguage form-control" size="0" onmousedown="if(this.options.length>11){this.size=12}" onblur="this.size=0" onchange="this.size=0">
                        {foreach from="$langs" item="_lang"}
                        <option data-slug="{$_lang.slug}" value="{$_lang.slug}"{if $_lang.slug==$lang} selected{/if}>{$_lang.name}（{$_lang.title}）</option>
                        {/foreach}
                    </select>
                </div>
            </div>
        </div>
    </div>
    {/if}

    <!-- 分类目录 -->
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">{$aside.categories.title}</h3>
        </div>
        <div class="panel-body">
            <!-- Panel content -->
            <div class="list-group">
                {foreach from="$aside.categories.list" item="item"}
                {if $item.num}
                <a href="{$item.link}" title="{$item.name|strip_tags}" class="list-group-item{if $item.id==$category_id} active{/if}">
                    <span class="badge">{$item.num}</span>
                    {$item.name}
                </a>
                {/if}
                {foreachelse}
                <p class="text-muted">{$localize.no_category}</p>
                {/foreach}
            </div>
        </div>
    </div>

    <!-- 页面 -->
    {if count($aside.pages.list)}
    <div class="panel panel-default panel-pages">
        <div class="panel-heading">
            <h3 class="panel-title">{$aside.pages.title}</h3>
        </div>
        <div class="panel-body">
            <!-- Panel content -->
            <div class="list-group">
                {foreach from="$aside.pages.list" item="item"}
                {if $item.pid}
                <a href="{$item.link}" data-slug="{$item.slug}" data-id="{$item.id}" title="{$item.name|strip_tags}" class="list-group-item{if $item.id==$page_id} active{/if}">
                    <span class="badge"></span>
                    {$item.name}
                </a>
                {/if}
                {foreachelse}
                <p class="text-muted">{$localize.no_page}</p>
                {/foreach}
            </div>
        </div>
    </div>
    {/if}

    <!-- 标签 -->
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">{$aside.tags.title}</h3>
        </div>
        <div class="panel-body">
            <!-- Panel content -->
            {foreach from="$aside.tags.list" item="item" name="item"}
            <a class="label label-{if $smarty.foreach.item.iteration % 6 == 0}default{/if}{if $smarty.foreach.item.iteration % 6 == 1}primary{/if}{if $smarty.foreach.item.iteration % 6 == 2}success{/if}{if $smarty.foreach.item.iteration % 6 == 3}info{/if}{if $smarty.foreach.item.iteration % 6 == 4}warning{/if}{if $smarty.foreach.item.iteration % 6 == 5}danger{/if}" href="{$item.link}" title="{$item.name|strip_tags} ({$item.num} {$localize.articles})" rel="nofollow">{$item.name}({$item.num})</a>
            {foreachelse}
            <p class="text-muted">{$localize.no_tag}</p>
            {/foreach}
        </div>
    </div>

    <!-- 热门文章 -->
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">{$aside.hot.title}</h3>
        </div>
        <div class="panel-body">
            <!-- Panel content -->
            <div class="list-group">
                {foreach from="$aside.hot.list" item="item"}
                <a href="{$item.link}"{if $item.id == $article_id} rel="nofollow"{/if} title="{$item.title|strip_tags}" class="list-group-item{if $item.id == $article_id} active{/if}">
                    <span class="badge">{$item.likes}</span>
                    <span class="glyphicon glyphicon-fire{if $item.id != $article_id} text-muted{/if}" aria-hidden="true"></span>
                    {$item.title}
                </a>
                {foreachelse}
                <p class="text-muted">{$localize.no_hot}</p>
                {/foreach}
            </div>
        </div>
    </div>

    {if $is_detail || $is_category}
    <!-- 详情或分类页(非grid页)本类最新 -->
    <div class="panel panel-default" id="panel-affix">
        <div class="panel-heading">
            <h3 class="panel-title">{$aside.self.title}</h3>
        </div>
        <div class="panel-body">
            <!-- 搜索框 -->
            <div class="row">
                <div class="col-md-12">
                    <form class="form-group" action="{$site_url}/{if $lang=='zh-CN'}{else}{$lang}/{/if}search.html" method="get">
                        <div class="input-group">
                            <input type="text" class="form-control" name="q" value="{$q|strip_tags}" placeholder="Search for..." required="required" />
                            <span class="input-group-btn search-btn">
                                <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
                            </span>
                        </div>
                    </form>
                </div>
            </div>

            <!-- 本类更新 start -->
            <div class="row">
                <div class="col-md-12">
                    <div class="list-group">
                        {foreach from="$aside.self.list" item="item" name="item"}
                        <a href="{$item.link}"{if $item.id == $article_id} rel="nofollow"{/if} title="{$item.title|strip_tags}" class="list-group-item{if $item.id == $article_id} active{/if}{if $smarty.foreach.item.index > 9} hidden{/if}">
                            {if ($item.likes && $item.update_at > time() - 24 * 3600 * 30) || $item.likes > 99}<span class="badge">Hot</span>{/if}
                            <span class="glyphicon glyphicon-list-alt{if $item.id != $article_id} text-muted{/if}" aria-hidden="true"></span>
                            {$item.title}
                        </a>
                        {if $smarty.foreach.item.last && $smarty.foreach.item.index > 9}
                        <nav aria-label="Page navigation">
                            <ul class="pager" data-index="0">
                              <li class="disabled" data-type="prev"><a href="javascript:;" title="Previous">Previous</a></li>
                              <li data-type="next"><a href="javascript:;" title="Next">Next</a></li>
                              <li data-type="all"><a href="javascript:;" title="All">All</a></li>
                            </ul>
                        </nav>
                        {/if}
                        {foreachelse}
                        <p class="text-muted">{$localize.no_update}</p>
                        {/foreach}
                    </div>
                </div>
            </div>
            <!-- 本类更新 end -->
        </div>
    </div>
    {/if}

    {if $is_index}
    <!-- 首页最新评论 -->
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">{$aside.comment.title}</h3>
        </div>
        <div class="panel-body">
            <!-- 媒体对象 -->
            {foreach from="$aside.comment.list" item="item" name="item"}
            <div class="media">
                <a rel="nofollow" href="{$item.article_link}#comment-{$item.id}" title="{$item.article_title|strip_tags}">
                    <div class="media-left">
                        <img class="media-object img-circle avatar"
                            style="width: 64px;height: 64px;background-color: #f1f1f1;"
                            src="{if $item.avatar}{$item.avatar}{else}{/if}"
                            alt="{if $item.nickname}{$item.nickname}{else}{$localize.anonymous}{/if}"
                            title="{if $item.nickname}{$item.nickname}{else}{$localize.anonymous}{/if}" />
                    </div>
                    <div class="media-body">
                        <h4 class="media-heading"><strong>{if $item.nickname}{$item.nickname}{else}{$localize.anonymous}{/if}</strong> <cite>{$localize.say}：</cite></h4>
                        <span class="text-muted">{$item.comment|strip_tags|modifier:mb_strimwidth(0, 70, '...', 'UTF-8')}</span>
                    </div>
                </a>
            </div>
            {if !$smarty.foreach.item.last}
            <hr>
            {/if}
            {foreachelse}
            <p class="text-muted">{$localize.no_comment}</p>
            {/foreach}
            <!-- 媒体对象End -->
        </div>
    </div>
    {/if}
</div>